package com.maikang.exammall.entity.dto.order;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Range;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;


@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RefundOrderInputDTO {

    @NotEmpty
    @Valid // validate recursively
    private List<OrderItemRefundBrief> orderItemRefundBriefs;


    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @JsonIgnoreProperties(ignoreUnknown = true)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class OrderItemRefundBrief {

        @ApiModelProperty("orderItemId")
        private Long id;
        private Long orderId;
        @ApiModelProperty("退款原因id, 3-买多了/不想买了 4-信息写错，重新下单 5-朋友/网上评价不好 6-计划有变，时间按排不上，7-其他")
        @Range(min = 3, max = 7)
        private Integer refundReasonId;
        @ApiModelProperty("退款原因的备注")
        private String refundReasonRemark = "";
    }
}
